<include file="Public:header" />
<include file="Public:leftside" />
<div class="main-content">
	<div class="breadcrumbs breadcrumbs-fixed" id="breadcrumbs">
		<ul class="breadcrumb">
			<li> <i class="icon-home home-icon"></i>
				<a href="/">首页</a>
			</li>
			<li class="active">分类管理</li>
		</ul>
	</div>
	<section class="scrollable wrapper">
		<section class="panel panel-default">
			<header class="panel-heading font-bold"> 添加文章分类</header>
			<div class="panel-body">
				<form class="form-horizontal" id="form" name="form" onsubmit="">
					<div class="form-group">
						<label class="col-sm-2 control-label">分类名称</label>
						<div class="col-md-4">
							<input type="text" class="form-control" id="name" value="">
						</div>
					</div>
					<div class="line line-dashed line-lg pull-in"></div>
					<div class="form-group">
						<label class="col-sm-2 control-label">上级分类</label>
						<div class="col-sm-4">
							<select id="pid" name="account" class="form-control m-b">
								<option value="0">顶级分类</option>
								<foreach name="list" item="v">
									<option value="{$v.term_id}">{$v.name}</option>
								</foreach>
								
								
							</select>
						</div>
					</div>
					<div class="line line-dashed line-lg pull-in"></div>
					<div class="form-group">
						<label class="col-sm-2 control-label">seo标题</label>
						<div class="col-md-4">
							<input type="text" class="form-control" id="seo_title" value="">
						</div>
					</div>
					<div class="line line-dashed line-lg pull-in"></div>
					<div class="form-group">
						<label class="col-sm-2 control-label">seo关键词</label>
						<div class="col-md-4">
							<input type="text" class="form-control" id="seo_keywords" value="">
						</div>
					</div>
					<div class="line line-dashed line-lg pull-in"></div>
					<div class="form-group">
						<label class="col-sm-2 control-label">seo描述</label>
						<div class="col-md-4">
							<input type="text" class="form-control" id="seo_description" value="">
						</div>
					</div>
					<div class="line line-dashed line-lg pull-in"></div>
					<div class="form-group">
						<label class="col-sm-2 control-label">排序</label>
						<div class="col-md-1">
							<input type="text" class="form-control" id="sort" value="999">
						</div>
					</div>
					
					<div class="line line-dashed line-lg pull-in"></div>
					<div class="form-group">
						<div class="col-sm-4 col-sm-offset-2">
							<a href="javascript:void(0);" onclick="addArticleClassAjax()" class="btn btn-primary">保存</a>
						</div>
					</div>
				</form>
			</div>
		</section>
		<script type="text/javascript">
			/**
			 * 添加分类
			 */
			function addArticleClassAjax() {
				var name = $("#name").val();
				var pid = $("#pid").val();
				var sort = $("#sort").val();
				var seo_title = $("#seo_title").val();
				var seo_keywords = $("#seo_keywords").val();
				var seo_description = $("#seo_description").val();
				if(name==''){layer.msg('请输入分类名称');return;}
				
				$.ajax({
					type: "post",
					url: "{:U('portal/trem_list_add')}",
					data: {
						'name': name,
						'pid': pid,
						'sort': sort,
						'seo_title': seo_title,
						'seo_keywords': seo_keywords,
						'seo_description': seo_description,
					},
					async: true,
					success: function(data) {
						if(data["code"] > 0) {
							layer.msg('添加成功');
							setTimeout("window.location.href='{:U("portal/trem_list")}'",1000)
							
						} else {
							layer.msg('添加失败');
							
						}
					}
				});
			}
		</script>

	</section>

</div>

<include file="Public:footer" />